Skip to content

Fix url-shortener python deploy scripts on current Azure CLI - #151

Closed
lazarkanelov wants to merge 1 commit into
mainfrom
fix/url-shortener-python-deploy-scripts
Closed

lazarkanelov wants to merge 1 commit into
mainfrom
fix/url-shortener-python-deploy-scripts

Conversation

@lazarkanelov

Copy link
Copy Markdown
Contributor

Problem

Running the url-shortener/python sample against the latest localstack/localstack-azure image with Azure CLI 2.82.0 fails in two deploy scripts. Neither failure is an emulator issue.

  1. scripts/deploy.sh: az postgres flexible-server db create --name is rejected (unrecognized arguments: --name clicks). Current Azure CLI only accepts --database-name. A failed run also leaves a PostgreSQL server whose generated password was never saved, so the next run exits with "admin password is unknown".
  2. bicep/deploy.sh: Azure CLI prints "Bicep CLI is already installed at ..." on stdout during az deployment group create. The script captures stdout and pipes it to jq, so parsing fails ("jq: parse error") and the script exits with "Web App Name or Function App Name is empty" even though the deployment succeeded. --only-show-errors does not suppress the line.

Fix

  • scripts/deploy.sh: --name -> --database-name.
  • bicep/deploy.sh: after the deployment succeeds, keep only the JSON (sed -n '/^{/,$p') before the jq calls.

Verification

Latest localstack/localstack-azure image, Azure CLI 2.82.0, Apple silicon. From a clean state each time:

  • scripts/deploy.sh then scripts/validate.sh: all validation checks passed.
  • bicep/deploy.sh then scripts/validate.sh: all validation checks passed.
  • Terraform variant was already passing unchanged (not touched here).

- scripts/deploy.sh: use --database-name for 'az postgres flexible-server db create'; Azure CLI 2.82 rejects --name.
- bicep/deploy.sh: keep only the JSON deployment outputs; Azure CLI prints a Bicep notice on stdout that broke jq parsing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified in the deployment-script updates for current Azure CLI compatibility.

No open issues 🎉

What changed in this PR

Updates the Python URL shortener sample’s deployment scripts to handle current Azure CLI behavior.

Changes:

  • Uses --database-name when creating the PostgreSQL database.
  • Removes leading CLI notices from Bicep deployment output before parsing the JSON with jq.
File Description
samples/​url-shortener/​python/​scripts/​deploy.sh Replaces the unsupported database creation argument.
samples/​url-shortener/​python/​bicep/​deploy.sh Filters stdout to retain JSON before extracting deployment outputs.

Review effort: Balanced

@lazarkanelov

Copy link
Copy Markdown
Contributor Author

Closing: this was based on a test with an outdated Azure CLI (2.82.0 from Homebrew). On current Azure CLI (2.91/2.92) the original scripts work unmodified, and the --database-name change breaks CI. Sorry for the noise.

@lazarkanelov
lazarkanelov deleted the fix/url-shortener-python-deploy-scripts branch November 10, 2026 14:35

This branch had an error being deployed

1 failed deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants